<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Margin合并问题</title>
</head>
<body>
    <!-- 上面兄弟元素的下外边距和下面兄弟的上外边距会合并取一个最大值，而不是相加 -->
    <div class="box box1"></div>
    <div class="box box2"></div>
    <hr>
    <div class="test test1"></div>
    <div class="test test2"></div>
    <style>
        .box{
            width:200px;
            height: 200px;
        }
        .test{
            width: 50px;
            height: 50px;
            display: inline-block;
        }
        .box1{
            background-color: red;
            margin-bottom: 50px;
        }
        .box2{
            background-color: blue;
            margin-top: 60px;
        }
        .test1{
            background-color: red;
            margin-right: 50px;
        }
        .test2{
            background-color: blue;
            margin-left: 50px;
        }
    </style>
</body>
</html>